<?php

/**
 * zc_user_info filter form base class.
 *
 * @package    zc
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Basezc_user_infoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_name'    => new sfWidgetFormFilterInput(),
      'info_sex'     => new sfWidgetFormChoice(array('choices' => array('' => '', '男' => '男', '女' => '女'))),
      'info_compay'  => new sfWidgetFormFilterInput(),
      'info_mobel'   => new sfWidgetFormFilterInput(),
      'area_no'      => new sfWidgetFormFilterInput(),
      'tel'          => new sfWidgetFormFilterInput(),
      'qq'           => new sfWidgetFormFilterInput(),
      'msn'          => new sfWidgetFormFilterInput(),
      'other_im'     => new sfWidgetFormFilterInput(),
      'email'        => new sfWidgetFormFilterInput(),
      'birthday'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'recommended'  => new sfWidgetFormFilterInput(),
      'from_keyword' => new sfWidgetFormFilterInput(),
      'from_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('zc_from'), 'add_empty' => true)),
      'area_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('zc_area'), 'add_empty' => true)),
      'industry_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('zc_industry'), 'add_empty' => true)),
      'user_id'      => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'user_name'    => new sfValidatorPass(array('required' => false)),
      'info_sex'     => new sfValidatorChoice(array('required' => false, 'choices' => array('男' => '男', '女' => '女'))),
      'info_compay'  => new sfValidatorPass(array('required' => false)),
      'info_mobel'   => new sfValidatorPass(array('required' => false)),
      'area_no'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'tel'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'qq'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'msn'          => new sfValidatorPass(array('required' => false)),
      'other_im'     => new sfValidatorPass(array('required' => false)),
      'email'        => new sfValidatorPass(array('required' => false)),
      'birthday'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'recommended'  => new sfValidatorPass(array('required' => false)),
      'from_keyword' => new sfValidatorPass(array('required' => false)),
      'from_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('zc_from'), 'column' => 'from_id')),
      'area_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('zc_area'), 'column' => 'area_id')),
      'industry_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('zc_industry'), 'column' => 'industry_id')),
      'user_id'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('zc_user_info_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'zc_user_info';
  }

  public function getFields()
  {
    return array(
      'info_id'      => 'Number',
      'user_name'    => 'Text',
      'info_sex'     => 'Enum',
      'info_compay'  => 'Text',
      'info_mobel'   => 'Text',
      'area_no'      => 'Number',
      'tel'          => 'Number',
      'qq'           => 'Number',
      'msn'          => 'Text',
      'other_im'     => 'Text',
      'email'        => 'Text',
      'birthday'     => 'Date',
      'recommended'  => 'Text',
      'from_keyword' => 'Text',
      'from_id'      => 'ForeignKey',
      'area_id'      => 'ForeignKey',
      'industry_id'  => 'ForeignKey',
      'user_id'      => 'Number',
    );
  }
}
